package com.boot.ys.mybatisplus.service.impl;

import com.boot.ys.mybatisplus.entity.Abc;
import com.boot.ys.mybatisplus.mapper.AbcMapper;
import com.boot.ys.mybatisplus.service.AbcService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Yang Sheng
 * @since 2021-11-18
 */
@Service
public class AbcServiceImpl extends ServiceImpl<AbcMapper, Abc> implements AbcService {

    @Autowired
    private AbcMapper abcMapper;

    public List<Abc> test(){
        List<Abc> abcs = abcMapper.selectList(null);
        return abcs;

    }


    @Override
    public void insertList(String array ) {

        List<Abc> objects = new ArrayList<>();

        String[] split = array.split(";");

        for (int i = 0 ; i <split.length;i++){
            Abc a  = new Abc();
            a.setName(split[i]);
            objects.add(a);
        }
        abcMapper.insertList(objects);
    }


}
